import java.text.SimpleDateFormat;
import java.util.*;

public class test {
	public static void main(String[] args) {

		/*ArrayList<Integer> num = new ArrayList<>();

		for (int i =0 ;i<=19;i++){
			num.add(i);
		}

		Integer num1 = num.get(18);

		num.remove(num1);

		System.out.println(num);

		String s = new String("aaa");

		int i = Integer.parseInt(s);
		System.out.println(i);*/

		ArrayList al = new ArrayList();
		al.add("a");
		al.add("b");
		al.add("b");
		al.add("c");
		al.add("d");


		Map<Integer,String> map=new HashMap<>();
		map.put(1,"第一个");
		map.put(2,"第二个");
		map.put(3,"第三个");
		map.put(4,"第四个");

		/*遍历key的方式*/
		Set<Integer> integers = map.keySet();
		for (int i : integers){
			System.out.println(map.get(i));
		}

		/*entryset方式*/
		Set<Map.Entry<Integer, String>> entries = map.entrySet();
		for (Map.Entry<Integer, String> entries1 : map.entrySet()){
			System.out.println(entries1.getValue());
		}

		Iterator<Map.Entry<Integer, String>> iterator = map.entrySet().iterator();
		while (iterator.hasNext()){
			System.out.println(iterator.next());
		}

		for (String s :map.values()){
			System.out.println(s);
		}
	}
}
